Scale-Gradient Example

created with NetLogo

view/download model file: Scale-Gradient Example.nlogo

VERSION

$Header: /home/cvs//netlogo/models/under\040development/code\040examples/Scale-Gradient\040Example.nlogo,v 1.7 2007-08-16 20:28:55 dkor Exp $


WHAT IS IT?

This code example demonstrates how the scale-gradient extension works.
In this particular example the gradient is taking the value of ( pxcor + (pycor * 10)). This is the sum of a patch's x-coordinate and y-coordinates times ten. As this sum becomes larger the patches color gradates from an initial color to a final color.


HOW IT WORKS

SCALE-GRADIENT [ [r g b] [r g b]] value range1 range2
where the first [r g b] list is the initial color
and the second [r g b] list is the final color.

The syntax and behavior is similar to the SCALE-COLOR primitive otherwise:


HOW TO USE IT

For a smooth transition between colors. Make sure that SCALE-COLOR does not fulfill your needs first. Gradients can be very impressing and aesthetical but hard to understand. Make sure that the starting and ending colors have an intuitive meaning, and that the gradations between them are consistent with that meaning.


THINGS TO NOTICE

There is a maximum of 256 colors between the start color and the end color.
Note (0, 0) is not in the middle of the world it is in the left bottom part of the world.


RELATED MODELS

Scale-Schemes Example
Color Gradient Example


CREDITS AND REFERENCES

Author: Daniel Kornhauser

Palette Extension: http://ccl.northwestern.edu/~dkor/extensions/palette/

ColorBrewer: http://www.colorbrewer.org/

Harrower, M. and C. Brewer (2003). ColorBrewer: An online tool for selecting color schemes for maps. The Cartographic Journal 40(1): 27-37. http://www.geography.wisc.edu/~harrower/pdf/ColorBrewer2003.pdf )

The gradient is determined using the GradientPaint class from java:
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/GradientPaint.html

For a simple tutorial of how GradientPaint works refer to:
http://www.oreilly.com/catalog/java2d/chapter/ch04.html

For a visualization overview refer to:
Healey, C. G. "Fundamental Issues of Visual Perception for Effective Image Generation." In SIGGRAPH 99 Course 6:
http://www4.ncsu.edu/~healey/download/sig-course.99.pdf

For a textbook refer to:
Information Visualization, Second Edition: Perception for Design by Colin Ware